package com.sdtw.bookshop.shop.mapper;

import com.sdtw.bookshop.shop.bean.BookKindInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
@Repository
public interface BookKindMapper {

    @Select("select * from kind")
    List<BookKindInfo> findAll();

    @Select("select * from kind where kindId=#{kindId}")
    @Results({
            @Result(property = "kindId",column = "kindId",id = true),
            @Result(property = "kindName",column = "kindName"),
            @Result(property = "bookClassInfo",column = "bcid",one=@One(select ="com.sdtw.bookshop.shop.mapper.BookClassMapper.findById"))
    })
    List<BookKindInfo> findById(Integer kindId);
}
